import React from "react";
import { useState } from "react";
import B from "./B";
//1. 创建并暴露 context 对象 『环境对象』
export let Context = React.createContext();
export default function A() {
  //声明状态
  let [count, setCount] = useState(101);

  return (
    <div>
      <div>A</div>
      {/* 2. 使用 Context.Provider 组件包裹子组件 */}
      <Context.Provider value={[count, setCount]}>
        <B />
      </Context.Provider>
    </div>
  );
}
